Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont use gnu specific grep #885

Closed
wants to merge 4 commits into from
Closed

Conversation

brian-level
Copy link
Contributor

grep -oP is specific to GNU versions of grep which aren't (any longer) used on Mac/OSX platforms. The use in scripts is a bit overkill for just getting a token. This replaces grep with bash-native parsing

Copy link

google-cla bot commented Jun 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lmnotran lmnotran self-requested a review June 12, 2024 19:04
Copy link
Contributor

@lmnotran lmnotran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brian-level ! Thanks for submitting the PR!

Theoretically, you shouldn't have run into this issue if you ran ./script/bootstrap on your system since it installs GNU grep. Every system is different though, so maybe I missed something. Either way, replacing -oP with bash-native parsing is an improvement. Could you remove grep from script/bootstrap in this PR as well?

Also, please sign the CLA.

@brian-level
Copy link
Contributor Author

Hi @brian-level ! Thanks for submitting the PR!

Theoretically, you shouldn't have run into this issue if you ran ./script/bootstrap on your system since it installs GNU grep. Every system is different though, so maybe I missed something. Either way, replacing -oP with bash-native parsing is an improvement. Could you remove grep from script/bootstrap in this PR as well?

Also, please sign the CLA.

CLA I had signed earlier for a PR to openthread. Maybe it'll apply here?

Question: in "openthread/scripts/check-api-version" it seems like the line 59

[[ $(wc -l <"${OT_VERSIONS_FILE}") == 2 ]] || die 'Multiple OPENTHREAD_API_VERSION definitions found!'

Will flag the normal case since the grep looks for [-+]#define so will have 2 lines? I think that == should be a != ?

@jwhui
Copy link
Member

jwhui commented Jun 12, 2024

CLA I had signed earlier for a PR to openthread. Maybe it'll apply here?

@brian-level , yes it applies here as well. Thanks.

@brian-level
Copy link
Contributor Author

brian-level commented Jun 12, 2024

Question: in "openthread/scripts/check-api-version" it seems like the line 59

[[ $(wc -l <"${OT_VERSIONS_FILE}") == 2 ]] || die 'Multiple OPENTHREAD_API_VERSION definitions found!'

Will flag the normal case since the grep looks for [-+]#define so will have 2 lines? I think that == should be a != ?

Please see above question. not sure about it.

I will make a new PR in openthread/openthread with the above script change

I think I need to leave grep in the bootstrap. There could be cases where people on non-Macs need it, or on Macs if they haven't installed the xcode commandline tools perhaps.

The issue is that newer mac os doesnt allow even sudo access to /usr/bin and other places where things like grep are installed by Xcode which override brew apps. I have this issue with cmake as well. Using simpler greps is better IMHO anyway but there was really nothing wrong with the scripts except for Apple deciding to be Apple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants